package org.example.controller;

import org.example.api.TestService;
import org.example.res.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author liyishan
 * @date 2023/7/21 16:35
 * @apiNote
 */
@RestController
@RequestMapping("test")
public class TestController {
    @Autowired
    private TestService testService;

    @GetMapping("demo")
    public String demo(){
        return testService.demo();
    }

    @GetMapping("demo1")
    public String demo1(@RequestParam("name") String name){
        return testService.demo1(name);
    }

    @PostMapping("demo2")
    public User demo2(@RequestBody User name){
        return testService.demo2(name);
    }
}
